/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package heitor.hosts.servicos;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author heitorsantos
 */

public class DAOJPAContasPagar extends DAOJPA<ContasPagar, Integer> {
    
    public List<ContasPagar> getByEmissao(String Emissao){
           return getEntityManager().createNamedQuery("ContasPagar.findByEmissao").setParameter("e2Emissao", Emissao)
                   .getResultList();
       }
    
    public List<ContasPagar> getNaoLib(){
        List<String> inList = new ArrayList<String>();   
        inList.add("'1201001'");  
        inList.add("'1201009'");   
        inList.add("'1201018'");
        inList.add("'1201023'");
        inList.add("'1201017'");
        inList.add("'1201019'");
        inList.add("'1201020'");
        inList.add("'1207019'");
        inList.add("'1207020'");
        inList.add("'1201070'");
        inList.add("'1214031'");
        inList.add("'1214032'");
        inList.add("'1214033'");
        inList.add("'1201068'");
        inList.add("'1201024'");
        inList.add("'1201069'");
        inList.add("'1201010'");
        inList.add("'1217083'");
        inList.add("'1201057'");
        inList.add("'1201071'");

        /*
        return getEntityManager().createQuery("Select e from ContasPagar e where e.e2Usualib=' ' and e.dELET<>'*' and e.e2Naturez in (:listEmail)").setParameter("listEmail", inList)
                   .getResultList();
        */
        return getEntityManager().createQuery("Select e from ContasPagar e where e.e2Usualib=' ' and e.dELET<>'*' ").getResultList();
    }

    public ContasPagar getById(Long recno) {
        //throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        return (ContasPagar) getEntityManager().createNamedQuery("ContasPagar.findById").setParameter("rECNO", recno)
                   .getSingleResult();
    }
}
